﻿@using Global.Core.ExtensionMethod
@using Ducu.SRV.ViewModel.Plan.Shared;
@model _ShowItemBodyModel
@if (string.IsNullOrEmpty(Model.Description))
{
    <p>暂时还没有描述……</p>
}
else
{
    <p>@Model.Description</p>
}

<div class="container">
    <a href="/Task/History/Month/@ViewBag.Id/@DateTime.Now.Year/@DateTime.Now.Month" class="btn btn-default pull-right">完成情况</a>
</div>
<div style="clear:both">
    <a class="show_link" data-planid="@ViewBag.Id"><span class="glyphicon glyphicon-link"></span>目标链接</a>
</div>
<div class="show_plan_url" style="clear:both; padding-top: 6px; display: none;">
    <a href="/Plan/Show/@ViewBag.Id">@("http://" + Request.Url.Host + "/Plan/Show/" + ViewBag.Id)</a>
</div>
<hr />
<p>
    <label>苦修：</label>
    <a href="/User/Profile/@Model.Vower.Id">@Model.Vower.Name</a>
</p>
<p>
    <label>
        关键字：
    </label>
    @for (int j = 0; j < Model.Keywords.Count; j++)
    {
        <span class="label label-info label-rectify" style="margin-right:6px;">
            @Model.Keywords[j].Name
        </span>
    }
</p>
<p>
    <label>建立于：</label>
    <span>@Model.CreateTime.ToChineseDate()<small style="margin-left:6px;">@Model.CreateTime.ToChineseTime()</small></span>
</p>
<p>
    <label class="second_level">从：</label>
    <span>@Model.From.ToChineseDate()</span>
</p>
<p>
    <label class="second_level">到：</label>
    <span>
        @if (Model.To.HasValue)
        {
            @Model.To.Value.ToChineseDate()
        }
        else
        {
            <text>永远</text>
        }
    </span>
</p>
<p>
    <label>交作业时间（每周）：</label>
    @Html.Partial("Shared/_TaskFulfilPlan", Model.FulfilWeekdays, new ViewDataDictionary { { "isDisabled", "disabled" } })
</p>
<p>
    <label>可以延期：</label>
    <span>@Model.Expire 天</span>
</p>
<p>
    <label>可以请假：</label>
    <span>@Model.DaysOfLeave 天</span>
</p>
@*the null value of Model.Proof will be not passed into Partial view*@
@if (Model.Proof != null)
{
    @Html.Partial("_Proof", Model.Proof)
}
<p>
    <label>最大督工人数：</label>
    <span>@Model.MaxNumberOfSupervisors 人</span>
</p>
<p>
    <label class="second_level">已有：</label>
    <span>@Model.Supervisors.Count 人</span>
</p>
@if (Model.Supervisors.Count > 0)
{
    <ul>
        @foreach (var item in Model.Supervisors)
        {
            <li><a href="/User/Profile/@item.Id">@item.Name</a></li>
        }
    </ul>
}
<p>
    <label class="second_level">还需：</label>
    <span> @(Model.MaxNumberOfSupervisors - Model.Supervisors.Count) 人</span>
</p>
@*TODO: move them to the panel's footer?*@



<div class="pull-right">
    @if (Model.ShowButton.Contains(Can.Fulfil))
    {
        <a href="/Task/Fulfil/@ViewBag.Id" class="btn btn-primary">交作业</a>
    }
    @if (Model.ShowButton.Contains(Can.Edit))
    {
        <a href="/Plan/Edit/@ViewBag.Id" class="btn btn-primary">修改</a>
    }
    @if (Model.ShowButton.Contains(Can.Join))
    {
        <a href="#" class="btn btn-primary" join_plan_id="@ViewBag.Id">马上加入</a>
        <button type="button" class="btn btn-default" data-toggle="modal" data-target="#introduction">
            说明
        </button>
    }
    @if (Model.ShowButton.Contains(Can.Accept))
    {
        <a href="/Task/Accept/@ViewBag.Id" class="btn btn-primary">验收</a>
    }
</div>
